Skip to content

Implement Layer 2 runtime validation (RFC-0001, COTS schema v1.1.0) - #3

Merged
emmanuel-a-otchere merged 1 commit into
mainfrom
vibe/rfc0001-layer2-floor-8eb746
Oct 30, 2026
Merged

emmanuel-a-otchere merged 1 commit into
mainfrom
vibe/rfc0001-layer2-floor-8eb746

Conversation

@emmanuel-a-otchere

Copy link
Copy Markdown
Contributor

Summary

  • Implement the Layer 2 (Runtime Validation) module src/layer2/layer2.ts per RFC-0001 and the v0.2 contract (layer-contracts/layer-2-runtime-validation.md): takes a Layer 1 COTS plus operator-provided CalibrationData, evaluates drift, segment-signal divergence, and parameter-set ranges, and attaches a validation record to every DecisionRecord
  • Add the ValidationRecord / ValidationFlag / DecisionOnValidation types to src/cots.ts (COTS schema v1.1.0; field optional, so v1.0.0 producers are unaffected)
  • Add tests/layer2.test.ts: 8 tests mirroring TC-L2-01..06 plus the contract's failure modes (calibration-data-missing, context-missing) and the no-silent-rejection guarantee
  • Add .gitignore (node_modules, dist, build output) - the repo had none

Verification

  • npx vitest run: 18/18 tests pass (10 existing Layer 1 + 8 new Layer 2)
  • npx tsc --noEmit: clean

Contract compliance

  • Layer 2 does not reject; it flags. Flagged decisions are still returned and exposed to Layer 3
  • The Validation record is attached before Layer 3 sees the decision
  • Failure modes return calibration-data-missing and context-missing errors per the contract

…he v0.2 contract; add .gitignore

Co-authored-by: emmanuel-a-otchere <emmanuel-a-otchere@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants